import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
        { path: '/', redirect: '/manager/home' },
        {
            path: '/manager',
            component: () => import('../views/Manager.vue'), // 添加箭头函数包裹
            children: [
                {
                    path: 'home',
                    component: () => import('../views/Home.vue') // 添加箭头函数包裹
                },
                {
                    path: 'admin',
                    component: () => import('../views/Admin.vue') // 添加箭头函数包裹
                },
                {
                    path: 'user',
                    component: () => import('../views/User.vue') // 添加箭头函数包裹
                }
            ]
        },
        {
            path: '/login',
            component: () => import('../views/Login.vue') // 添加箭头函数包裹
        },
        {
            path: '/register',
            component: () => import('../views/Register.vue') // 添加箭头函数包裹
        },
        {
            path: '/notFound',
            component: () => import('../views/404.vue') // 添加箭头函数包裹
        },
        { path: '/:pathMatch(.*)', redirect: '/notFound' }
    ],
})

export default router